package fr.sedoo.commons.client.widget.table;

import java.util.ArrayList;

import com.google.gwt.user.cellview.client.SimplePager;

import fr.sedoo.commons.client.longlist.widget.InternationalizedSimplePager;
import fr.sedoo.commons.shared.domain.HasIdentifier;


public abstract class AbstractPagedTable extends AbstractTable {
	public final static int DEFAULT_PAGE_SIZE = 10;
	public final static int DEFAULT_POSITION = 1;

	private final SimplePager pager;

	public AbstractPagedTable() {
		super();
		setHeaderPanelVisible(true);
		pager = new InternationalizedSimplePager();
		pager.setDisplay(itemTable);
		headerPanel.add(pager);
		getDataProvider().addDataDisplay(itemTable);

	}

	public void reset() {
		pager.setPageSize(DEFAULT_PAGE_SIZE);
		pager.setPageStart(0);
		itemTable.setRowData(0, new ArrayList<HasIdentifier>());
		itemTable.setRowCount(0);
		setHeaderPanelVisible(false);
		checkEmptyPanelVisibility();
	}

}
